Imports ModuloAdministraciondeEnvios.DataAccessLayer
Imports ModuloAdministraciondeEnvios.BusinessLogicLayer


Namespace PresentationLayer
    Public Class FrmBuscaPorCliente

        Private Sub FrmBuscaPorCliente_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            DataGridViewClientes.RowHeadersVisible = False
            DataGridViewClientes.AllowUserToAddRows = False
            DataGridViewClientes.AllowUserToOrderColumns = False
            DataGridViewClientes.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
            DataGridViewClientes.CellBorderStyle = DataGridViewCellBorderStyle.None


            Dim Clientes As ICliente = DirectCast(New DataCliente, ICliente)
            Datos = Clientes.TraerRegistroClientePorNombre("")
            Me.DataGridViewClientes.DataSource = Datos.Tables(0)

        End Sub

        Private Sub TextBoxNombreCliente_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBoxNombreCliente.TextChanged


            Dim Clientes As ICliente = DirectCast(New DataCliente, ICliente)
            Datos = Clientes.TraerRegistroClientePorNombre(TextBoxNombreCliente.Text)
            Me.DataGridViewClientes.DataSource = Datos.Tables(0)

        End Sub

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        End Sub

        Private Sub DataGridViewClientes_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridViewClientes.CellContentClick

            Dim ClientePorID As ICliente = DirectCast(New DataCliente, ICliente)
            Cliente = ClientePorID.TraerRegistroCliente(CInt(DataGridViewClientes.Rows(e.RowIndex).Cells(0).Value))

            ClienteID = Cliente.IDCliente
            ClienteNombre = Cliente.Nombre
            ClienteDomicilio = Cliente.Domicilio
            ClienteCUIT = Cliente.CUIT
            ClienteLocalidad = Cliente.Localidad

            Me.Close()


        End Sub
    End Class
End Namespace